#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Comzyh
# @Date:   2014-11-09 02:29:42
# @Last Modified by:   Comzyh
# @Last Modified time: 2014-11-09 03:16:09
import random
import sys
def random_list(n,t,group_number=4,):
	result = []
	for g in range(group_number):
		result.append([])
		for i in range(t):
			result[g] += range(n)
		satisfied = False
		while satisfied == False:
			random.shuffle(result[g])
			satisfied = True
			for fg in range(g):
				for i in range(n*t):
					if result[fg][i] == result[g][i]:
						satisfied= False
	return result
def main():
	files = sys.stdin.read().split("\n")
	d = random_list(len(files),3)
	for l in range(len(files) * 3):
		print files[d[0][l]],files[d[1][l]],files[d[2][l]],files[d[3][l]]

if __name__ == '__main__':
	main()
